package com.example.demo.entity;

import cn.ljserver.tool.weboffice.v3.model.UserInfo;
import com.easy.query.core.annotation.Column;
import com.easy.query.core.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table("t_user")
public class User {

    @Column(primaryKey = true)
    private long id;

    private String nickname;

    private String avatar;

    /**
     * 转换为适用web office的UserInfo
     */
    public UserInfo toUserInfo() {
        return UserInfo.builder()
                .id(String.valueOf(this.id))
                .name(this.nickname)
                .avatarUrl(this.avatar)
                .build();
    }
}